﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Example3_ws3_level.Model
{
    
    class Level
    {
        /// <summary>
        /// different tile types are represented by enum
        /// if the tile has state I normally use a class instead
        /// </summary>
        public enum Tile
        {
            T_EMPTY = 0,
            T_BLOCKED,
            T_TRAP
        };

        //width and heigt
        internal const int g_levelWidth  = 20;
        internal const int g_levelHeight = 7;

        //the 2D array of tiles
        internal Tile[,] m_tiles = new Tile[g_levelWidth, g_levelHeight];

        internal Level()
        {
            GenerateLevel();
        }

        

        private void GenerateLevel()
        {
            
            for (int x = 0; x < g_levelWidth; x++)
            {
                for (int y = 0; y < g_levelHeight; y++)
                {
                    m_tiles[x, y] = Tile.T_EMPTY; //set every tile to empty
                }
                //set bottom tiles to blocked
                m_tiles[x, g_levelHeight - 1] = Tile.T_BLOCKED;
            }

            //add a block at some location
            m_tiles[2, 3] = Tile.T_BLOCKED;

            //add a trap in the middle
            m_tiles[g_levelWidth / 2, g_levelHeight - 1] = Tile.T_TRAP;
        }
    }
}
